package cn.minsh.lims.eoms.modules.app.utils;

public class StringConstants {


    public static String analysisExplain(String explain,Long userId){
        if (userId==-1){
            return explain ;
        }else{
            return explain.replace(userId+"","") ;
        }
    }
    public static Long analysisExplain(String operation,String explain){
        if (("发起工单".equals(operation)||"修改经办人".equals(operation)||"修改工单".equals(operation)) && explain.indexOf("发起人")>-1){
            String[] arrs =  explain.split(":") ;
            if (arrs.length==1) {
                arrs =  explain.split("：") ;
            }
            if (arrs.length==2) {
                return Long.valueOf(arrs[1].trim());
            }
        }else if (("发起工单".equals(operation)||"修改经办人".equals(operation)||"修改工单".equals(operation)) && explain.indexOf("报修人")>-1){
            String[] arrs =  explain.split(":") ;
            if (arrs.length==1) {
                arrs =  explain.split("：") ;
            }
            if (arrs.length==2) {
               return Long.valueOf(arrs[1].trim());
            }
        }else if(("发起工单".equals(operation)||"修改经办人".equals(operation)||"修改工单".equals(operation)) && explain.indexOf("经办人")>-1){
            String[] arr = explain.split(":") ;
            if(arr.length==1){
                arr = explain.split("：") ;
            }
            if (arr.length==2){
                return Long.valueOf(arr[1].trim());
            }
        }else if(("发起工单".equals(operation)||"修改经办人".equals(operation)||"修改工单".equals(operation)) && explain.indexOf("保修人")>-1){
            String[] arr = explain.split(";") ;
            if(arr.length==1){
                arr = explain.split("；") ;
            }
            if (arr.length==2){
                return Long.valueOf(arr[1].trim());
            }
        }
        return -1L ;
    }

    public static void main(String[] args) {
        Long userId = analysisExplain("修改工单","修改工单经办人为：100") ;
        System.out.println(userId);
        System.out.println(analysisExplain("修改工单经办人为：100",userId));

    }
}
